-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cache plugin modules #9031
Cache plugin modules #9031
Conversation
Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the contributing guide. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #9031 +/- ##
==========================================
- Coverage 86.66% 86.61% -0.06%
==========================================
Files 179 179
Lines 26564 26569 +5
==========================================
- Hits 23022 23013 -9
- Misses 3542 3556 +14
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great!!!
Python 3.8 lacks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very neat!!
core/dbt/plugins/manager.py
Outdated
@@ -63,6 +65,17 @@ def get_manifest_artifacts(self, manifest: Manifest) -> PluginArtifacts: | |||
raise NotImplementedError(f"get_manifest_artifacts hook not implemented for {self.name}") | |||
|
|||
|
|||
@functools.cache |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@peterallenwebb Per docs, sounds like @functools.cache
might just be 3.9+ syntactic sugar for @functools.lru_cache(maxsize=None)
, which is available on earlier versions?
resolves #9029
Local results:
Problem
Scanning all available python modules is slow.
Solution
For the purposes of detecting dbt plugins, only do this once per process invocation and cache the result.
Checklist